$(function() {

	//报表
	function baobiao() {
		$(document).ready(function() {
			var title = {
			   text: '订单报表'   
			};
			var xAxis = {
			   categories: arr2
			};
			var yAxis = {
			 title: {
				  text: 'Money '
			   },
			   plotLines: [{
				  value: 0,
				  width: 1,
				  color: '#808080'
			   }]
			};   
		 
			var tooltip = {
			   valueSuffix: '￥'
			}
		 
			var legend = {
			   layout: 'vertical',
			   align: 'right',
			   verticalAlign: 'middle',
			   borderWidth: 0
			};
			var series =  [
			   {
				name: 'Tendency',
				data:arr
			   }
			];
		 
			var json = {};
		 
			json.title = title;
			json.xAxis = xAxis;
			json.yAxis = yAxis;
			json.tooltip = tooltip;
			json.legend = legend;
			json.series = series;
		 
			$('#container').highcharts(json);	
		 });
		
	}
	 var arr=[];
	 var arr2=[];
	 
	 //本周报表数据
	 $("body").on("click", "._thisWeek",function() {
		$.get(
			"/food/statement/week.do?ran="+Math.random(),
			{str:"-1"},
			function(data){
				arr.splice(0,arr.length);
				$.each(data, function(i,item) {
					arr[i]=item.foodOrderInfoPrice;
					arr2[i]=item.foodOrderInfoTime;
				});
				console.info(arr)
			},"json"
		);
		baobiao();
		return false;
	});
	 
	//上周报表数据
	 $("body").on("click", "._lastWeek",function() {
		$.get(
			"/food/statement/week.do?ran="+Math.random(),
			function(data){
				arr.splice(0,arr.length);
				$.each(data, function(i,item) {
					arr[i]=item.foodOrderInfoPrice;
					arr2[i]=item.foodOrderInfoTime;
				});
				console.info(arr)
			},"json"
		);
		baobiao();
		return false;
	});
	 
	//上月报表数据
	 $("body").on("click", "._lastMonth",function() {
		$.get(
			"/food/statement/lastmonth.do?ran="+Math.random(),
			function(data){
				arr.splice(0,arr.length);
				$.each(data, function(i,item) {
					arr[i]=item.foodOrderInfoPrice;
					arr2[i]=item.foodOrderInfoTime;
				});
				console.info(arr)
			},"json"
		);
		baobiao();
		return false;
	});
	 
	//本月报表数据
	 $("body").on("click", "._thisMonth",function() {
		$.get(
			"/food/statement/month.do?ran="+Math.random(),
			function(data){
				arr.splice(0,arr.length);
				$.each(data, function(i,item) {
					arr[i]=item.foodOrderInfoPrice;
					arr2[i]=item.foodOrderInfoTime;
				});
				console.info(arr)
			},"json"
		);
		baobiao();
		return false;
	});
	console.info(arr)
	baobiao();
});